var path=require("path");
var htmlwebpackplugin=require("html-webpack-plugin");
var VueLoaderPlugin=require("vue-loader/lib/plugin.js");

module.exports={
    entry:path.join(__dirname, "./src/main.js"),
    output: {
        path: path.join(__dirname, "./dist"),
        filename: "bundle.js"
    },
    plugins: [
        new htmlwebpackplugin({ /*htmlwebpackplugin插件作用是在内存中生成一份一模一样的页面并把bundle.js添加到页面最底部*/
            template:path.join(__dirname,"./src/index.html"),//指定模板文件路径
            filename: "index.html"//设置生成的内存页面名称
        }),
        new VueLoaderPlugin() //解决安装的vue-loader是15之上的版本不识别.vue文件
    ],
    module:{//配置所有的第三方loader模块
        rules: [ 
            {test:/\.css$/,use:["style-loader","css-loader"]},/*处理cssdeloader*/
            {test:/\.less$/,use:["style-loader","css-loader","less-loader"]},/*处理lessdeloader*/
            {test:/\.scss$/,use:["style-loader","css-loader","sass-loader"]},/*处理lessdeloader*/
            {test:/\.(jpg|png|gif|bmp|jpeg)$/,use:"url-loader?limit=7399007&name=[hash:8]-[name].[ext]"},//处理图片路径deloader
            {test:/\.(ttf|eot|svg|woff|woff2)$/,use:"url-loader"},/* 处理字体文件的loader*/
            {test:/\.js$/,use:"babel-loader",exclude:/node_modules/},/*配置babel来转换高级的es6**/
            {test:/\.vue$/,use:"vue-loader"},/*处理.vue结尾的文件**/


        ]
    },
    resolve:{
        alias:{"vue$":"vue/dist/vue.js"}//引入node_modules中的vue.js,通过import引入的vue是阉割版的vue
    }

}